﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Jsptpd.Common.dataInital
{
    public class DataStructureConstractor
    {
        #region Attribute
        #region PrjInfoAllField
        const string PrjInfoAllField = " [ID]"
                                       + ",[DOMAINID]"
                                       + ",[ITEM_项目名称]"
                                       + ",[ITEM_项目编号]"
                                       + ",[ITEM_项目类型]"
                                       + ",[ITEM_主办部门]"
                                       + ",[ITEM_项目负责人]"
                                       + ",[ITEM_联系人]"
                                       + ",[ITEM_联系人办公电话]"
                                       + ",[ITEM_联系人部门]"
                                       + ",[ITEM_联系人手机]"
                                       + ",[ITEM_客商名称]"
                                       + ",[ITEM_客商省份]"
                                       + ",[ITEM_客商类别]"
                                       + ",[ITEM_预估收入]"
                                       + ",[ITEM_联系人电子邮箱]"
                                       + ",[ITEM_重点项目]"
                                       + ",[ITEM_申请部门]"
                                       + ",[ITEM_项目入口]"
                                       + ",[ITEM_当前阶段]"
                                       + ",[ITEM_项目编号备份]"
                                       + ",[ITEM_项目ID]"
                                       + ",[ITEM_是否有已签批的合同评审记录]"
                                       + ",[ITEM_项目负责人名称]"
                                       + ",[ITEM_立项日期]"
                                       + ",[ITEM_是否合作项目]"
                                       + ",[ITEM_分类标签]"
                                       + ",[ITEM_是否分单项]"
                                       + ",[ITEM_单项划分]"
                                       + ",[ITEM_专业]"
                                       + ",[ITEM_客商地区]"
                                       + ",[ITEM_实际完成日期]"
                                       + ",[ITEM_所有单项批复是否结束]"
                                       + ",[ITEM_项目入口类型]"
                                       + ",[ITEM_项目参与人员]"
                                       + ",[ITEM_阶段]"
            /*+ ",[STATELABELINFO]"
            + ",[PREVAUDITUSER]"
            + ",[PREVAUDITNODE]"
            + ",[ITEM_评审方式]"
            + ",[ITEM_协办部门]"
            + ",[ITEM_附件]"
            + ",[ITEM_项目情况说明]"
            + ",[ITEM_申请人ID]"
            + ",[ITEM_项目状态]"                                      
            + ",[ITEM_预估成本]"                      
            + ",[ITEM_登记日期]"
            + ",[ITEM_登记人]"
            + ",[ITEM_隶属公司]"
            + ",[ITEM_客户经理]"
            + ",[ITEM_立项方式]"
            + ",[ITEM_要求完成日期]"
            + ",[ITEM_委托日期]"
            + ",[ITEM_单位编号]"
            + ",[ITEM_预估依据]"
            + ",[ITEM_预估投资额]"
            + ",[ITEM_是否新市场业务]"
            + ",[ITEM_是否无收入项目]"
            + ",[ITEM_工号1]"
            + ",[ITEM_表单编号]"
            + ",[ITEM_立项评审方式]"
            + ",[PARENT]"
            + ",[LASTMODIFIED]"
            + ",[FORMNAME]"
            + ",[STATE]"
            + ",[AUDITUSER]"
            + ",[AUDITDATE]"
            + ",[AUTHOR]"
            + ",[AUTHOR_DEPT_INDEX]"
            + ",[CREATED]"
            + ",[ISSUBDOC]"
            + ",[FORMID]"
            + ",[ISTMP]"
            + ",[FLOWID]"
            + ",[VERSIONS]"
            + ",[SORTID]"
            + ",[APPLICATIONID]"
            + ",[STATEINT]"
            + ",[STATELABEL]"
            + ",[AUDITORNAMES]"
            + ",[LASTFLOWOPERATION]"
            + ",[LASTMODIFIER]"
            + ",[AUDITORLIST]"*/;
        #endregion


        const string PrjInfoValidField = " [ID]"
                                        + ",[DOMAINID]"
                                        + ",[ITEM_项目名称]"
                                        + ",[ITEM_项目编号]"
                                        + ",[ITEM_项目类型]"
                                        + ",[ITEM_主办部门]"
                                        + ",[ITEM_项目负责人]"
                                        + ",[ITEM_联系人]"
                                        + ",[ITEM_联系人办公电话]"
                                        + ",[ITEM_客商名称]"
                                        + ",[ITEM_阶段]";
        #endregion

        #region Function
        public static string constructSqlString(bool isFullField)
        {
            StringBuilder sb = new StringBuilder();
            if (isFullField == true)
            {
                sb.Append("select top 1000 " + PrjInfoAllField);
                sb.Append(" from [JSPTPD_PM].[dbo].[tlk_项目]");
            }
            else
            {
                sb.Append("select " + PrjInfoValidField);
                sb.Append(" from [JSPTPD_PM].[dbo].[tlk_项目]");
            }
            return sb.ToString();
        }


        public DataTable constructPrjinfoTable()
        {
            DataTable dt = new DataTable("prjInfoTable");
            dt.Columns.Add("编号");
            dt.Columns.Add("项目名称");
            dt.Columns.Add("项目编号");
            dt.Columns.Add("项目类型");
            dt.Columns.Add("主办部门");
            dt.Columns.Add("项目负责人");
            dt.Columns.Add("联系人");
            dt.Columns.Add("联系人办公电话");
            dt.Columns.Add("客商名称");
            return dt;
        }


        public DataTable constructAllPrjinfoTable()
        {
            DataTable dt = new DataTable("prjAllInfoTable");
            dt.Columns.Add("编号");
            dt.Columns.Add("项目名称");
            dt.Columns.Add("项目编号");
            dt.Columns.Add("项目类型");
            dt.Columns.Add("主办部门");
            dt.Columns.Add("项目负责人");
            dt.Columns.Add("联系人");
            dt.Columns.Add("联系人办公电话");
            dt.Columns.Add("客商名称");
            dt.Columns.Add("表单编号");
            dt.Columns.Add("工号1");
            dt.Columns.Add("是否无收入项目");
            dt.Columns.Add("单位编号");
            dt.Columns.Add("项目负责人名称");
            dt.Columns.Add("立项方式");
            dt.Columns.Add("项目入口");
            return dt;
        }
        #endregion


    }
}
